package com.botann.projects.base;

import java.util.List;

/**
 * Charging
 * ConditionParams
 * Created by 刘山国 on 2017/12/26.
 * Copyright (c) 2017 伯坦科技. All rights reserved
 */
public class ConditionParams {

    private List<String> conditionsList;
    private List paramsList;

//    public ConditionParams(Object conditions, Object[] parameters) {
//        if (conditions instanceof String ) conditions = new String[]{(String)conditions};
//        List<String> listConditions = new ArrayList<>();
//        List listParams = new ArrayList<>();
//        this.conditionsList = listConditions;
//        this.paramsList = listParams;
//        if (conditions == null || parameters == null) return;
//        for (int i=0;i<parameters.length;i++) {
//            String condition = ((String [])conditions)[i];
//            listConditions.add(condition);
//            listParams.add(parameters[i]);
//        }
//        for (int i=listParams.size()-1;i>=0;i--) {
//            if (listConditions.get(i).length()==0 && i>1 && listConditions.get(i-1).contains("between")) { // 结束日期
//                if (listParams.get(i) == null && listParams.get(i-1) == null) {
//                    listParams.remove(i);
//                    listConditions.remove(i);
//                } else {
//                    if (listParams.get(i) == null) listParams.set(i, Constant.END_DATE);
//                    if (listParams.get(i-1) == null) listParams.set(i, Constant.BEGIN_DATE);
//                }
//            } else {
//                if (listParams.get(i) == null) {
//                    listParams.remove(i);
//                    listConditions.remove(i);
//                }
//            }
//        }
//    }

    public String [] conditions() {
        String [] conditions = new String [this.conditionsList.size()];
        for (int i=0;i<conditionsList.size();i++) {
            String condition = conditionsList.get(i);
            conditions[i] = condition;
        }
        return conditions;
    }

    public Object[] params() {
        return this.paramsList.toArray();
    }


}
